<?php

use Phalcon\Mvc\Model;

class Words extends Model {

    protected $id;
    protected $blog;
    protected $from;
    protected $word;
    protected $visible;
    protected $create_date;
    protected $update_date;

    public function initialize() {
        $this->belongsTo("from", "Users", "id");
        $this->belongsTo("blog", "Blogs", "id");
    }

    public function getSource() {
		return "lb_word";
	}


    /**
     * Get the value of Id
     *
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set the value of Id
     *
     * @param mixed id
     *
     * @return self
     */
    public function setId($id)
    {
        $this->id = $id;

        return $this;
    }

    /**
     * Get the value of Blog
     *
     * @return mixed
     */
    public function getBlog()
    {
        return $this->blog;
    }

    /**
     * Set the value of Blog
     *
     * @param mixed blog
     *
     * @return self
     */
    public function setBlog($blog)
    {
        $this->blog = $blog;

        return $this;
    }

    /**
     * Get the value of From
     *
     * @return mixed
     */
    public function getFrom()
    {
        return $this->from;
    }

    /**
     * Set the value of From
     *
     * @param mixed from
     *
     * @return self
     */
    public function setFrom($from)
    {
        $this->from = $from;

        return $this;
    }

    /**
     * Get the value of Word
     *
     * @return mixed
     */
    public function getWord()
    {
        return $this->word;
    }

    /**
     * Set the value of Word
     *
     * @param mixed word
     *
     * @return self
     * TODO: check for sql
     */
    public function setWord($word)
    {
        $this->word = $word;

        return $this;
    }

    /**
     * Get the value of Create Date
     *
     * @return mixed
     */
    public function getCreateDate()
    {
        return $this->create_date;
    }

    /**
     * Set the value of Create Date
     *
     * @param mixed create_date
     *
     * @return self
     */
    public function setCreateDate($create_date)
    {
        $this->create_date = $create_date;

        return $this;
    }

    /**
     * Get the value of Update Date
     *
     * @return mixed
     */
    public function getUpdateDate()
    {
        return $this->update_date;
    }

    /**
     * Set the value of Update Date
     *
     * @param mixed update_date
     *
     * @return self
     */
    public function setUpdateDate($update_date)
    {
        $this->update_date = $update_date;

        return $this;
    }

    public function convertToArray() {
        return array(
            'id'        =>  (int)$this->id,
            'from'  =>  $this->users->convertToArray(),
            'word'      =>  $this->word,
            'create_date'   =>  $this->create_date,
            'update_date'   =>  $this->update_date
        );
    }

    /**
     * Get the value of Visible
     *
     * @return mixed
     */
    public function getVisible()
    {
        return $this->visible;
    }

    /**
     * Set the value of Visible
     *
     * @param mixed visible
     *
     * @return self
     */
    public function setVisible($visible)
    {
        $this->visible = $visible;

        return $this;
    }

}
